package com.lsb.blog.utils;

import com.lsb.blog.pojo.SysUser;

/**
 * @author ：liusibo
 * @description：TODO
 * @date ：2021/8/4 14:52
 */
public class UserThreadLocal {

    private UserThreadLocal(){}

    //线程变量隔离，每个线程的ThreadLocal中的变量互相隔离、互不干扰，只能在各自线程被使用
    private static final ThreadLocal<SysUser> LOCAL = new ThreadLocal<>();

    public static void put(SysUser sysUser){
        LOCAL.set(sysUser);
    }
    public static SysUser get(){
        return LOCAL.get();
    }
    public static void remove(){
        LOCAL.remove();
    }
}
